package utils
{
	import flash.display.DisplayObject;
	import flash.display.DisplayObjectContainer;
	import flash.geom.Point;

	public class DisplayTool
	{
		public static function removeAllChild(displayObjectContainer:DisplayObjectContainer):void
		{
			if (displayObjectContainer)
			{
				while(displayObjectContainer.numChildren > 0)
				{
					displayObjectContainer.removeChildAt(0);
				}
			}
		}
		
		public static function removeChild(parent:DisplayObjectContainer,child:DisplayObject):void
		{
			if (parent && child)
			{
				if (child.parent == parent)
				{
					parent.removeChild(child);
				}
			}
		}
		
		public static function getGlobalXY(target:DisplayObject):Point
		{
			var point:Point = target.localToGlobal(new Point());
			return point;
		}
	}
}